package com.hb.medical_research_system.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.hb.medical_research_system.common.Results;
import com.hb.medical_research_system.service.CollectionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "收藏")
@Slf4j
@RestController
@RequestMapping("/collection")
public class CollectionController {

    private final CollectionService collectionService;

    @Autowired
    public CollectionController(CollectionService collectionService) {
        this.collectionService = collectionService;
    }

    @ApiOperation("新增收藏接口")
    @PostMapping("/add")
    public Results add(@ApiParam("收藏文献的id") Long articleId){
        return collectionService.add(articleId);
    }

    @ApiOperation("删除收藏接口3")
    @PostMapping("/delete")
    public Results delete(@ApiParam("删除文献的id") Long articleId){
        return collectionService.delete(articleId);
    }

}
